package com.qa.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author 徐
 */
@Mapper
public interface AuthorityMapper {

    /**
     * 根据用户id查询权限（已存在）
     *
     * @param userId 用户id
     * @return List
     */
    @Select("SELECT authority FROM authority\n" +
            "WHERE id IN (\n" +
            "\tselect authority_id from user_authority where user_id = #{userId} and status = 1\n" +
            ");")
    List<String> getAuthorityByUserId(Long userId);

}
